<template>
  <div>
    <title-header :title="title"></title-header>
    <Group class="m-1-t">
      <cell is-link value="修改头像">
        <img slot="icon" class="head-icon" :src="userInfo.image" />
      </cell>
      <x-input title="昵称" :placeholder="userInfo.username" placeholder-align="right"></x-input>
      <datetime title="生日" v-model="userInfo.birthday" value-text-align="right"></datetime>
    </Group>
    <br>
    <router-link to="/userCenter">
      <x-button type="warn" action-type="reset" class="btn-place">确定</x-button>
    </router-link>
  </div>
</template>
<script>
import TitleHeader from '@/components/titleHeader.vue'
import { Group, Cell, Datetime, XInput, XButton } from 'vux'
import Data from '@/server/server.js'
export default {
  components: {
    Group,
    Cell,
    Datetime,
    XInput,
    XButton,
    TitleHeader
  },
  data () {
    return {
      userInfo: {},
      title: '修改资料'
    }
  },
  mounted (){
    Data.userInfo.then(data => {
        this.userInfo = data
      })
  }
}
</script>
<style scoped>
.head-icon {
  width: 50px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
}
.m-1-t {
  margin-top: -1.3em;
}
</style>